import 'package:flutter/material.dart';
import 'package:lan_file/utils/log.dart';

import '../utils/udp_socket.dart';
import 'find.dart';

class EntryPage extends StatefulWidget {
  const EntryPage({super.key});

  final title = 'wifi快传';

  @override
  State<EntryPage> createState() => _EntryPageState();
}

class _EntryPageState extends State<EntryPage> {
  @override
  void initState() {
    super.initState();
  }

  toMobileFind() {
    Navigator.pushNamed(context, 'routeName');
    Navigator.push(
      context,
      MaterialPageRoute(
        builder: (context) => const FindPage(
          isService: true,
        ),
      ),
    );
  }

  toCarFind() {
    Navigator.push(
      context,
      MaterialPageRoute(
        builder: (context) => const FindPage(),
      ),
    );
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.all(20.0),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: [
                  ElevatedButton(onPressed: toMobileFind, child: const Text('我是手机')),
                  ElevatedButton(onPressed: toCarFind, child: const Text('我是车机')),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
